<?php
/**
 * Created by Zend Studio.
 * User: FDG348
 * Date: 2017/9/6
 * Time: 11:10
 */
namespace backend\models;

use yii\db\ActiveRecord;

class SysMessageTemplate extends ActiveRecord{
	const TYPE_ONE	= 1;	//发送类型为短信
	const TYPE_TWO	= 2;	//站内信
	const TYPE_THR	= 3;	//邮件

	public static $template =[
		'sms_coupon_get'	=>['$sms_code'],
		'sms_coupon_push'	=>['$sms_coupon_cnt'],
		'sms_crcode'		=>['$sms_code'],
		//mod by FDG367 2018/04/16 587 【PC/WAP】会员注册成功后，发送短信。 start
		'sms_reg'			=>['$sms_reg'],
		//mod by FDG367 2018/04/16 587 【PC/WAP】会员注册成功后，发送短信。 end
	];

    public static function tableName(){
        return '{{%sys_message_template}}';
    }

    public function rules(){
        return [
            ['creator','getCreator']
        ];
    }

    /**
     * @获取创建人
     */
    public function getCreator(){
        $userInfo = \common\helps\tools::getloginUserInfo();
        if($userInfo){
            $userName = $userInfo->userName;
        }else{
            $userName = '';
        }
        return $userName;
    }

}